//Main
app.controller('meunCtr',['$scope','$timeout','$rootScope','meunCache', function($scope,$timeout,$rootScope,meunCache) {
    $scope.meunData = meunCache;

    $rootScope.$on('$stateChangeSuccess', function(evt, current, previous) {
        if(current.activeIndex){   //选择左侧菜单 切换 样式
            $scope.meunActiveIndex = current.activeIndex;
        }
    });

    $scope.toggleMeun = function(item){
        item.isShowMeun = !item.isShowMeun;
    };

    $timeout(function(){
        meunCache.forEach(function(item){
            if(item.child){
                item.child.forEach(function(childItem){
                    if(childItem.activeIndex === $scope.meunActiveIndex){
                        item.isShowMeun = true;
                    }
                });
            }
        });
    },100);



}]);
